/*
 * File:   CellUnitTest.cpp
 * Author: Guilherme Monteiro
 *
 */

#include "CellUnitTest.h"

CPPUNIT_TEST_SUITE_REGISTRATION(CellUnitTest);

CellUnitTest::CellUnitTest() {
}

CellUnitTest::~CellUnitTest() {
}

void CellUnitTest::setUp() {
}

void CellUnitTest::tearDown() {
}

void CellUnitTest::testContains() {
    CvPoint p1 = cvPoint(1,1);
    CvPoint p2 = cvPoint(3,3);
    
    CvPoint p3 = cvPoint(2,2);
    CvPoint p4 = cvPoint(3,3);
    
    Cell* otherCell = new Cell(p3,p4);
    Cell* cell = new Cell(p1,p2);
    bool result = cell->contains(otherCell);
    if (!result) {
        CPPUNIT_ASSERT(false);
    }
}

void CellUnitTest::testEquals() {
    CvPoint p1 = cvPoint(1,1);
    CvPoint p2 = cvPoint(3,3);
    
    CvPoint p3 = cvPoint(2,2);
    CvPoint p4 = cvPoint(3,3);
    
    Cell otherCell(p3,p4);
    Cell* cell = new Cell(p1,p2);
    
    bool result = cell->equals(otherCell);
    if (result) {
        CPPUNIT_ASSERT(false);
    }
}

void CellUnitTest::testIsValid() {
    CvPoint p1 = cvPoint(1,1);
    CvPoint p2 = cvPoint(1,2);
    
    CvPoint p3 = cvPoint(2,2);
    CvPoint p4 = cvPoint(3,2);
    
    Cell c1(p1,p2);
    Cell c2(p3,p4);
    Cell c3(p1,p3);
    
    bool result1 = c1.isValid();
    bool result2 = c2.isValid();
    bool result3 = c3.isValid();
    
    if (result1 || result2 || !result3) {
        CPPUNIT_ASSERT(false);
    }
}

